﻿@{
    ViewBag.Title = "Home Page";
}

<div class="jumbotron">
    <h1>ASP.NET</h1>
    <p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
    <p><a href="https://asp.net" class="btn btn-primary btn-lg">Learn more &raquo;</a></p>
</div>

<div class="row">
    <div class="col-md-4">
        <h2>Getting started</h2>
        <p>
            ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
            enables a clean separation of concerns and gives you full control over markup
            for enjoyable, agile development.
        </p>
        <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301865">Learn more &raquo;</a></p>
    </div>
    <div class="col-md-4">
        <h2>Get more libraries</h2>
        <p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
        <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301866">Learn more &raquo;</a></p>
    </div>
    <div class="col-md-4">
        <h2>Web Hosting</h2>
        <p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
        <p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301867">Learn more &raquo;</a></p>
    </div>
</div>
<button id="aaa">dsdsdasda</button>
<button id="bbb">发送</button>
<script src="http://pv.sohu.com/cityjson?ie=utf-8"></script>
<script src="~/Scripts/jquery-3.4.1.min.js"></script>
<script>
    var ws;
    function ConnetionWebSocket() {

        // $.ajax({
        //     type: "get"http://localhost:59434/
        // })
        
        if ("WebSocket" in window) {
            ws = new WebSocket("ws://192.168.100.49:811/Handler/LoginHandler/Validate.ashx")
            console.log("您的浏览器支持WebSocket");
            ws.onopen = function () {
                console.log("open");
                //ws.send("hello");
            }
            ws.onmessage = function (e) {
                console.log(e);
            }
            ws.onclose = function (e) {
                console.log(e.data);
            }
            ws.onerror = function (e) {
                console.log(e.data);
            }
        } else {
            console.log("您的浏览器不支持WebSocket");
        }
    }
    ConnetionWebSocket();

    $("#aaa").click(function () {
        console.log(ws);
        console.log(ws.readyState);
        ws.close();
    });
    $("#bbb").click(function () {
        console.log(ws.readyState);
        ws.send("dasdasd");
    });

    //function CacheLoginInfo() {
    //    //登陆地区
    //    var cdir = returnCitySN['cname'];
    //    var cid = returnCitySN['cid'];   //区域ID
    //    var userAgentss = navigator.appVersion; //游览器版本
    //    var mimeTypes = navigator.mimeTypes[1].type;  //类型
    //    var platform = navigator.platform; //平台
    //    var IP = returnCitySN['cip'];
    //    $.ajax({
    //        url: "http://localhost:44379/Home/Name",
    //        data: {
    //            Action: "loginSocket",
    //            cdir: cid,
    //            cdir: cdir,
    //            userAgentss: userAgentss,
    //            mimeTypes: mimeTypes,
    //            platform: platform,
    //            IP: IP
    //        },
    //        type: "POST",
    //        dataType: "JSON",
    //        success: function (result) {
    //            if (result.code != 1) {
    //                alert(result.message);
    //            }
    //        }
    //    });
    //}
    //CacheLoginInfo();
</script>